πŸ•ΈοΈ Ada Research Browser

LYNIS_REMOTE_DEPLOYMENT_2026-03-10.md
← Back

Lynis Remote Deployment Summary

Date: 2026-03-10 Status: βœ… COMPLETE (peter audit in progress) Architecture: Remote-execution via SSH


Deployment Summary

Successfully deployed remote Lynis audit capability to willie and peter. All audits are orchestrated from alfred and results are centrally stored in alfred's blueteam database.

Servers Deployed

1. Alfred (Local) - Execution: Local python script - Hardening Index: 64/100 - Status: βœ… COMPLETE

2. Willie (AWS EC2) - Execution: Remote via SSH - Hardening Index: 64/100 - Status: βœ… COMPLETE

3. Peter (Production) - Execution: Remote via SSH - Hardening Index: Pending - Status: ⏳ AUDIT RUNNING (~10+ minutes for large production server)


Architecture

Remote-Execution Model

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Alfred  β”‚ (Control Server - localhost)
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
      β”‚
      β”œβ”€ Run: python3 lynis-auditor.py alfred
      β”‚  └─ Local Lynis execution
      β”‚  └─ Direct database storage
      β”‚
      β”œβ”€ SSH: willie (mailcow.tailce791f.ts.net)
      β”‚  └─ Run: sudo lynis audit system
      β”‚  └─ Retrieve: /var/log/lynis-report.dat
      β”‚  └─ Parse and store in alfred database
      β”‚
      └─ SSH: peter (webhost.tailce791f.ts.net)
         └─ Run: sudo lynis audit system
         └─ Retrieve: /var/log/lynis-report.dat
         └─ Parse and store in alfred database

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ blueteam.lynis_* β”‚ (PostgreSQL on alfred)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Benefits

  1. Central Data Storage - All results in one database
  2. No Remote DB Access - Simpler security model
  3. Consistent Architecture - Matches compliance scanner
  4. Single Source of Truth - One dashboard for all servers

Scripts Created

1. audit-remote-server.sh (New)

Purpose: Run Lynis audit on a remote server via SSH

Usage:

bash scripts/audit-remote-server.sh <server-name> <ssh-host> <ssh-key>

Example:

bash scripts/audit-remote-server.sh willie mailcow.tailce791f.ts.net ~/.ssh/bq_laptop_rsa

Process: 1. SSH to remote server 2. Run sudo lynis audit system remotely 3. Retrieve /var/log/lynis-report.dat via SSH 4. Parse report file locally 5. Store findings in alfred's blueteam database

2. audit-all-servers.sh (New)

Purpose: Audit all three servers with one command

Usage:

bash scripts/audit-all-servers.sh

Process: - Audits alfred (local) - Audits willie (remote via SSH) - Audits peter (remote via SSH) - Displays combined security posture


Current Security Posture

Scores

Server Compliance Lynis Hardening Combined Status
alfred 100/100 64/100 82.0/100 βœ“ Good
willie 100/100 64/100 82.0/100 βœ“ Good
peter 95/100 Pending Pending ⏳ Audit Running

Findings Summary

Alfred: - Tests: 283 - Warnings: 2 (medium) - Suggestions: 55 (low) - Unresolved: 57

Willie: - Tests: 263 - Warnings: 1 (medium) - Suggestions: 48 (low) - Unresolved: 49

Peter: - Pending audit completion


Installation Details

Willie Deployment

# Install Lynis
ssh ubuntu@mailcow.tailce791f.ts.net "sudo apt-get install -y lynis"

# Verify installation
ssh ubuntu@mailcow.tailce791f.ts.net "lynis show version"
# Output: 3.0.9

# Run first audit
bash scripts/audit-remote-server.sh willie mailcow.tailce791f.ts.net ~/.ssh/bq_laptop_rsa

# Result: Hardening Index 64/100

Peter Deployment

# Install Lynis
ssh ubuntu@webhost.tailce791f.ts.net "sudo apt-get install -y lynis"

# Verify installation
ssh ubuntu@webhost.tailce791f.ts.net "lynis show version"
# Output: 3.0.9

# Run first audit (in progress)
bash scripts/audit-remote-server.sh peter webhost.tailce791f.ts.net ~/.ssh/webhost_key

# Status: Running (10+ minutes for large production server)

Database Integration

Schema: blueteam (PostgreSQL on alfred)

Tables: - lynis_audits - Audit summary records - lynis_findings - Individual warnings/suggestions

Views: - v_latest_lynis_audits - Most recent audit per server - v_security_posture - Combined compliance + Lynis scores - v_unresolved_lynis_findings - Actionable remediation list

Query Examples:

-- View all server scores
SELECT * FROM blueteam.v_security_posture ORDER BY combined_score DESC;

-- View willie findings
SELECT * FROM blueteam.v_unresolved_lynis_findings
WHERE server_name = 'willie'
ORDER BY severity;

-- View hardening trend
SELECT server_name, audit_date, hardening_index
FROM blueteam.lynis_audits
ORDER BY server_name, audit_date DESC;

Next Steps

Immediate (After Peter Audit Completes)

  1. Verify Peter Results sql SELECT * FROM blueteam.v_latest_lynis_audits WHERE server_name = 'peter';

  2. Review Combined Security Posture sql SELECT * FROM blueteam.v_security_posture;

  3. Identify High-Priority Findings sql SELECT * FROM blueteam.v_unresolved_lynis_findings WHERE severity IN ('high', 'medium') ORDER BY severity, server_name;

Short-Term (Next 7 Days)

  1. Configure Automated Scanning
  2. Add weekly cron job on alfred
  3. Email alerts for hardening index drops

  4. Address Medium-Severity Findings

  5. SMTP banner information disclosure
  6. System reboot requirements
  7. Redis configuration hardening

  8. Dashboard Integration

  9. Add Lynis tab to security dashboard UI
  10. Display hardening trends
  11. Show top findings across all servers

Medium-Term (Next 30 Days)

  1. Establish Baseline Targets
  2. Production servers: 80+ hardening index
  3. Document acceptable exceptions
  4. Track improvement over time

  5. Create Remediation Playbooks

  6. Common finding fixes
  7. Automated remediation scripts
  8. Resolution tracking

  9. Security Posture Monitoring

  10. Weekly audit execution
  11. Trend analysis
  12. Compliance reporting

Troubleshooting

Long Audit Times on Production Servers

Symptom: Peter audit taking 10-15 minutes Cause: Large number of files in WordPress installations Solution: Normal behavior - production servers with many files take longer Mitigation: Run audits during low-traffic periods

SSH Connection Issues

Symptom: "Connection refused" or "Permission denied" Cause: SSH keys not configured or firewall blocking Solution: Use correct SSH key for each server: - willie: ~/.ssh/bq_laptop_rsa - peter: ~/.ssh/webhost_key

Database Connection Errors

Symptom: "Connection refused" to PostgreSQL Cause: PostgreSQL not configured for remote access Solution: Use remote-execution architecture (current implementation) - Run audits via SSH - Store results locally on alfred - No remote database connections needed


Git Commits

1. Lynis Integration (ad52209) - Initial Lynis deployment - Database schema - Local auditor script - Documentation

2. Sudoers Configuration (74bb270) - Passwordless sudo for Lynis - Report file read permissions - Alfred configuration

3. Remote Execution Scripts (7287af9) - audit-remote-server.sh - audit-all-servers.sh - Remote deployment to willie and peter


Files Modified/Created

New Scripts: - scripts/audit-remote-server.sh (263 lines) - scripts/audit-all-servers.sh (45 lines)

Modified Scripts: - scripts/lynis-auditor.py - Added sudo for report reading

New Documentation: - findings/LYNIS_DEPLOYMENT_2026-03-10.md - findings/LYNIS_REMOTE_DEPLOYMENT_2026-03-10.md (this file)

Configuration: - /etc/sudoers.d/90-lynis-cyber-guardian (alfred)


Success Criteria


Performance Metrics

Audit Execution Times

Server Type Duration Tests Findings
alfred Local ~75s 283 57
willie Remote (AWS) ~120s 263 49
peter Remote (Production) ~600s+ Pending Pending

Note: Peter's longer execution time is expected due to: - Large production WordPress installation - Multiple sites and files - Comprehensive file system scanning


References


Deployment Status: βœ… COMPLETE (awaiting peter audit completion) Next Action: Monitor peter audit, verify results, configure automation


End of Report